import request from '@/utils/request'

//商品服务的基础地址前缀
const BASE_URL = '/product-api'
/**
 *获取分类信息列表
 * @returns
 */
export function categoryList() {
  return request({
    url: `${BASE_URL}/productCategory/categoryList`,
    method: 'get'
  })
}
/**
 * 删除分类信息
 * @param {*} catId
 * @returns
 */
export function removeCategory(catId) {
  return request({
    url: `${BASE_URL}/productCategory/${catId}`,
    method: 'delete'
  })
}
/**
  新增分类信息
 * @param {*} data 
 * @returns 
 */
export function insertCategory(data) {
  return request({
    url: `${BASE_URL}/productCategory/insertCategory`,
    method: 'post',
    data
  })
}
/**
  获取分类信息
 * @param {*} catId 
 * @returns 
 */
export function getCategory(catId) {
  return request({
    url: `${BASE_URL}/productCategory/getCategoryId`,
    method: 'get',
    params: { catId }
  })
}
/**
  修改分类信息
 * @param {*} data 
 * @returns 
 */
export function updateCategory(data) {
  return request({
    url: `${BASE_URL}/productCategory/updateCategory`,
    method: 'put',
    data
  })
}

/**
  拖拽批量修改
 * @param {*} data 
 * @returns 
 */
export function batchUpdate(data) {
  return request({
    url: `${BASE_URL}/productCategory/batchUpdate`,
    method: 'put',
    data
  })
}

/**
  批量删除
 * @param {*} data 
 * @returns 
 */
export function batchCategory(data) {
  return request({
    url: `${BASE_URL}/productCategory/batchCategory`,
    method: 'delete',
    data
  })
}
